var express = require('express');

var app = express();

app.listen(4000, function () {
  console.log('app is running');
});
app.use('/', express.static('./resource'));

app.get('/student', (request, response) => {
  console.log(123);
  response.append('Access-Control-Allow-Origin', "*");
  response.send(JSON.stringify('lwf'))
});

app.get('/text', (request, response) => {
  let {callback=Function.prototype}=request.query;
  let data='lwf'

  console.log(111,callback)

  //将函数名和将要返回的数据拼接成字符串然后反馈给浏览器
  response.send(`${callback}(${JSON.stringify(data)})`)
});

